#ifndef __YMAKER_NRF24L01_H
#define __YMAKER_NRF24L01_H

#include <Arduino.h>
#include "Wire.h"

#define I2C_ADD         0X02
#define I2C_ADD1        0X03

#define REG_CHECK       0X0A  
#define REG_TX_ADD      0X30
#define REG_RX_ADD      0X31
#define REG_TX_DATA     0X32
#define REG_RX_STATE    0X33
#define REG_RX_DATA     0X34

class nrf24l01Class
{
public:
    bool check();          //24l01检测OK返回true，否则返回false
    void setTxAdd(uint8_t *add);
    void setRxAdd(uint8_t *add);
    void writeData(uint8_t *add,uint8_t len,uint8_t *dat);
    void writeData(uint8_t *add,uint8_t dat);     //发送一个byte
    bool readData(uint8_t *buf);
    bool writeReadData(uint8_t *add,uint8_t *tbuf,uint8_t *rbuf); //向某地址写数据并读取返回值
    
    bool readRxState();
    void readRxData(uint8_t *buf);      //默认读回来4个byte
    uint8_t readRxData();               //返回读回来的1个byte

};

#endif
